﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InspectionMAC.Config
{
    public static class ProductInfoManager
    {
        private static string _currentProductId = "DEFAULT_PRODUCT_ID";
        public static string _currentProductName = "DEFAULT_PRODUCT_NAME";

        public static string CurrentProductId
        {
            get => _currentProductId;
            set
            {
                if (string.IsNullOrWhiteSpace(value))
                {
                    Console.WriteLine("警告: 尝试设置空的产品ID");
                }
                else
                {
                    _currentProductId = value.Trim();
                    Console.WriteLine($"产品ID已更新: {value}");
                }
            }
        }

        public static string CurrentProductName
        {
            get => _currentProductName;
            set
            {
                if (string.IsNullOrWhiteSpace(value))
                {
                    Console.WriteLine("警告: 尝试设置空的产品名称");
                }
                else
                {
                    _currentProductName = value.Trim();
                    Console.WriteLine($"产品名称已更新: {value}");
                }
            }
        }

        public static void SetProductInfo(string id, string name)
        {
            CurrentProductId = id;
            CurrentProductName = name;
        }
    }
}
